home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / menuit1a / frmmenu.frm (.txt) next >
Visual Basic Form  |  1999-06-15  |  5KB  |  119 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMenu 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Menu Items With Pictures And Words"
  5.    ClientHeight    =   2520
  6.    ClientLeft      =   1305
  7.    ClientTop       =   1860
  8.    ClientWidth     =   6690
  9.    Height          =   3210
  10.    Left            =   1245
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    ScaleHeight     =   2520
  14.    ScaleWidth      =   6690
  15.    Top             =   1230
  16.    Width           =   6810
  17.    Begin ComctlLib.ImageList img 
  18.       Left            =   240
  19.       Top             =   240
  20.       _ExtentX        =   1005
  21.       _ExtentY        =   1005
  22.       BackColor       =   16777215
  23.       ImageWidth      =   13
  24.       ImageHeight     =   13
  25.       MaskColor       =   16777215
  26.       _Version        =   327682
  27.       BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
  28.          NumListImages   =   5
  29.          BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  30.             Picture         =   "frmMenu.frx":0000
  31.             Key             =   ""
  32.          EndProperty
  33.          BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  34.             Picture         =   "frmMenu.frx":00FA
  35.             Key             =   ""
  36.          EndProperty
  37.          BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  38.             Picture         =   "frmMenu.frx":01F4
  39.             Key             =   ""
  40.          EndProperty
  41.          BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  42.             Picture         =   "frmMenu.frx":02EE
  43.             Key             =   ""
  44.          EndProperty
  45.          BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
  46.             Picture         =   "frmMenu.frx":03E8
  47.             Key             =   ""
  48.          EndProperty
  49.       EndProperty
  50.    End
  51.    Begin VB.Menu mnuFile 
  52.       Caption         =   "&File"
  53.       Begin VB.Menu mnuOpen 
  54.          Caption         =   "&Open"
  55.       End
  56.       Begin VB.Menu mnuDesign 
  57.          Caption         =   "&Design"
  58.       End
  59.       Begin VB.Menu mnuDelete 
  60.          Caption         =   "D&elete"
  61.       End
  62.       Begin VB.Menu mnuProperties 
  63.          Caption         =   "&Properties"
  64.       End
  65.       Begin VB.Menu mnuSep1 
  66.          Caption         =   "-"
  67.       End
  68.       Begin VB.Menu mnuTest 
  69.          Caption         =   "&Test"
  70.       End
  71.    End
  72.    Begin VB.Menu mnuHelp 
  73.       Caption         =   "&Help"
  74.       Begin VB.Menu mnuHelpTopics 
  75.          Caption         =   "&Help Topics"
  76.       End
  77.       Begin VB.Menu mnuSep2 
  78.          Caption         =   "-"
  79.       End
  80.       Begin VB.Menu mnuAbout 
  81.          Caption         =   "&About"
  82.       End
  83.    End
  84. Attribute VB_Name = "frmMenu"
  85. Attribute VB_Creatable = False
  86. Attribute VB_Exposed = False
  87. Option Explicit
  88. Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
  89. Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
  90. Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
  91. Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As Long
  92. Private Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long
  93. Private Declare Function GetMenuCheckMarkDimensions Lib "user32" () As Long
  94. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  95. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
  96. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  97. Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
  98. Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
  99. Private Declare Function GetDesktopWindow Lib "user32" () As Long
  100. Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
  101. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  102. Private Sub Form_Load()
  103.   Dim i%
  104.   Dim hMenu, hSubMenu, menuID, x
  105.   hMenu = GetMenu(hwnd)
  106.   hSubMenu = GetSubMenu(hMenu, 0) '1 for "Other" menu etcetera
  107.   For i = 1 To 4
  108.     menuID = GetMenuItemID(hSubMenu, i - 1)
  109.     x = SetMenuItemBitmaps(hMenu, menuID, &H4, img.ListImages(i).Picture, img.ListImages(i).Picture)
  110.   Next
  111.   menuID = GetMenuItemID(hSubMenu, 5)
  112.   x = SetMenuItemBitmaps(hMenu, menuID, 0, img.ListImages(5).Picture, 0&)
  113. End Sub
  114. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  115.   If Button = 2 Then
  116.     PopupMenu mnuFile, 2, x
  117.   End If
  118. End Sub
  119.